<?php
namespace app\index\model;

use think\Model;

class UserGangModel extends Model
{

    protected $table = 'newzs_user_gang';

    /**
     * @param int $id
     * @return array|null|string|Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function get_info_by_pk($id=0){
        return self::where(['id'=>$id])->find();
    }


    /**
     * @param int $id
     * @return mixed
     */
    public static function get_name_by_pk($id=0){
        return self::where(['id'=>$id])->value('name');
    }

    public static function get_name_by_ids($ids, $d=','){
        $arr = [];
        $data = self::field('name')->where('id','in',$ids)->select();
        foreach ($data as $k=>$v){
            $arr[$k] = $v['name'];
        }
        $name = implode($d, $arr);
        return $name;
    }

}
